import React, { Component } from 'react'
import Header from '../components/IndexHeader_c';
import ListInput from '../components/ListInput_c';
import FormBtn from '../components/FormBtn_c';

export default class MyPage extends Component {

    state = {
        files: [{
            url: 'http://localhost:3000/header.jpg',
        }],
        nickname: '伍豪',
        username: '13820454350'
    }


    handleClick = () => {
        console.log(111);
        this.props.history.go(-1)
    }
    onChange = (files) => {
        this.setState({
            files,
        });
    };
    hanleChange = (typeName,e) => {
        console.log(typeName);
        this.setState({
            [typeName]: e.target.value
        })
    }
    render() {
        return (
            <div>
                <Header onClick={this.handleClick}>个人页面</Header>
                <ListInput onChange={(e) => {this.hanleChange('nickname',e)}} value={this.state.nickname} text="昵称"></ListInput>
                <ListInput onChange={(e) => {this.hanleChange('username',e)}} value={this.state.username} text="手机号"></ListInput>
                <ListInput onChange={this.onChange} files={this.state.files} text="头像" types='img'></ListInput>
                <br />
                <FormBtn>提交信息</FormBtn>
            </div>
        )
    }
}